home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cpptutor.arc / CLOCK.CPP < prev    next >
Text File  |  1991-04-28  |  514b  |  32 lines

  1. #include "clock.hpp"
  2. #include "stdio.h"
  3.  
  4.  
  5.  
  6. clock::clock(void)
  7. {
  8.    hour = 8;
  9.    minute = 51;
  10. }
  11.  
  12.  
  13.  
  14.  
  15. void
  16. clock::inc_and_print_time(void)
  17. {
  18.    minute++;            // Add one minute to the time
  19.    if (minute > 59) {
  20.       minute -= 60;
  21.       hour++;
  22.    }
  23.  
  24.                         // Output the user prompt
  25.    printf("\n      It is now %d:", hour);
  26.    if (minute < 10)
  27.       printf("0%dam", minute);
  28.    else
  29.       printf("%dam", minute);
  30.    printf(", what do you wish to do?     ");
  31. }
  32.